<%@page import="cn.school.mybatis.pojo.Grade"%>
<%@page import="java.util.List"%>
<%@page import="cn.school.mybatis.service.GradeService"%>
<%@page import="cn.school.mybatis.pojo.Student"%>
<%@page import="cn.school.mybatis.service.StudentService"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
 long stuno=Long.parseLong(request.getParameter("stuno"));
 Student student=StudentService.SERVICE.get(stuno);
 if(student==null){
	 out.print("<script>alert('没有了');history.back();</script>");
	 return;
 }
//StudentService service=new StudentService();
%>
<!-- 值自动绑定 -->
<form action="doUpdateStudent.jsp" method="post">
   <input type="text" name="stuno" value="<%=student.getId()%>" readonly="readonly"/>
   
   姓名:<input type="text" name="sname" value="<%=student.getSname()%>"/>
   
   QQ:<input type="text" name="qq" value="<%=student.getQq() %>"/>
   入学日期:<input type="text" name="enterdate" value="<%=student.getEnterdate2()%>"/>
  <br/>
  年级:
  <select name="gradeid">
 	<%
 		//>
 		
 		GradeService gs=new GradeService();
 		List<Grade> list=gs.select();
 		for(Grade g:list){
 		%>
 		<%
 		  if(student.getGradeid()==g.getId()){
 		%>
 		<option value="<%=g.getId()%>" selected><%=g.getGname()%></option>
 	<%		
 		}else{
 	%>
 	<option value="<%=g.getId()%>" ><%=g.getGname()%></option>
 	<%
 		 }
 		}
 	%> 
 </select>
 <input type="radio" value="男" name="sex">男
 <input type="radio" value="女" name="sex">女
 <input type="radio" value="妖" name="sex">妖
 <input type="radio" value="人妖" name="sex">人妖
   <input type="submit" value="保存"/>
</form>
<script type="text/javascript" src="../js/jquery-3.4.1.min.js"></script>
<script type="text/javascript">
$(function(){
	$(":radio[value=<%=student.getSex()%>]").prop("checked",true);
	
});
</script>
</body>
</html>